import Vue from 'vue'
import VueRouter from 'vue-router'
import App from './App.vue'
import store from './store'

Vue.config.productionTip = false // 取消生成环境下提示
// 全局样式导入
import '@/styles/global.less'
import 'animate.css'
// 插件导入-包括自己的插件
import loadingDirective from '@/directives/loading'
import lazyDirective from '@/directives/lazy'
if (!window.VueRouter) {
	Vue.use(VueRouter)
}
Vue.directive('loading', loadingDirective)
Vue.directive('lazy', lazyDirective)
// 原型加入事件总线
import eventBus from './utils/eventBus'
Vue.prototype.$bus = eventBus
// 导入路由对象
import router from '@/router/index'
// 导入mockjs设置拦截
// import '@/mock'
// 全局组件/Vue实例注册弹窗消息函数
import showMessage from './utils/showMessage'
Vue.prototype.$showMessage = showMessage

// 先加载远程数据初始化全局setting的仓库
store.dispatch('setting/fetchSettings')

// vue实例
const app = new Vue({
	render: (h) => h(App),
	router: router, // vue-router,
	store,
})
app.$mount('#app')
